﻿using System;
using System.Collections.Generic;

using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Collections;

using System.Text;
using System.IO;
using System.Net;

public partial class _Default : System.Web.UI.Page
{
    protected List<Model.UsersAccount> userAccount = null;
    protected decimal winmonenyTotal = 0;
    protected ArrayList yi = new ArrayList();
    protected ArrayList wan = new ArrayList();
    protected ArrayList yuan = new ArrayList();
    protected string jiangjin = "";
    protected decimal jiangjin2 = 0;
    protected Model.LotteryAnnouncement SSQLottery = null;
    protected string[] SSQList = null;
    protected string SSQblue = null;
    protected Model.LotteryAnnouncement DLTLottery = null;
    protected string[] DLTList = null;
    protected string[] DLTblue = null;
    protected Model.LotteryAnnouncement FCLottery = null;
    protected string[] FCList = null;
    //protected List<Model.NewsSite> tzlist = null;
    protected string islogin, name = "";
    protected decimal ye = 0;

    protected List<Model.ForecastPost> tzlist = null;
    protected void Page_Load(object sender, EventArgs e)
    {
        //推荐方案
        //string sqltj = "";
        //sqltj = " Order by Id desc";
        int totalCount4 = 0;
        tzlist = BLL.ForecastPost.GetPageListBysql(0, 6, "", out totalCount4);


        //int totalcount = 0;
        //tzlist = BLL.NewsSite.GetPageList_Where(0, 6, 7, out totalcount);
        //用户账户
        int totalCount2 = 0;
        userAccount = BLL.UsersAccount.getList(0, int.MaxValue, out totalCount2);
        foreach (Model.UsersAccount user in userAccount)
        {
            winmonenyTotal += user.winTotal;
        }
        long a = Convert.ToInt64(winmonenyTotal) / 100000000;
        string b = a.ToString();
        jiangjin2 = Convert.ToDecimal(winmonenyTotal) / 100000000;
        long w = Convert.ToInt64(winmonenyTotal) % 100000000 / 10000;
        string wb = w.ToString();
        long y = Convert.ToInt64(winmonenyTotal) % 10000;
        string yb = y.ToString();
        jiangjin = b + "亿" + wb + "万" + yb + "元";

        bindLottery();
        CkLogin();
    }

   
    protected void bindLottery()
    {
        //双色球top1
        SSQLottery = BLL.LotteryAnnouncement.getModelByLotteryType(1);
        if (SSQLottery != null)
        {
            string[] ssqflaglist = SSQLottery.LotteryNo.Split('+');
            SSQList = ssqflaglist[0].Split(',');
            SSQblue = ssqflaglist[1];
        }
        DLTLottery = BLL.LotteryAnnouncement.getModelByLotteryType(2);
        if (DLTLottery != null)
        {
            string[] ssqflaglist = DLTLottery.LotteryNo.Split('+');
            DLTList = ssqflaglist[0].Split(',');
            DLTblue = ssqflaglist[1].Split(',');
        }
        FCLottery = BLL.LotteryAnnouncement.getModelByLotteryType(5);
        if (FCLottery != null)
        {
            FCList = FCLottery.LotteryNo.Split(',');
        }
    }
    public string SelectName(object Uid)
    {
        Model.CMember cm = BLL.CMember.GetModel(Convert.ToInt32(Uid));
        if (cm != null)
        {
            return cm.nickname;//用户真实姓名
        }
        else
        {
            return "***";
        }
    }
    protected void CkLogin()
    {
        //获取登录信息
        Model.CMember loginUserInfo = BLL.CMember.UserLoginInfo();
        //当前用户没有登录
        if (loginUserInfo == null)
        {
            islogin = "0";
        }
        else
        {
            islogin = "1";
            name = loginUserInfo.nickname;
            Model.UsersAccount user_account = BLL.UsersAccount.GetModelByuser_id(loginUserInfo.Id);
            if (user_account != null)
            {
                ye = user_account.total;
            }
        }
    }

   
}
